ManagedGroundSdk

An GroundSdk session automatically managed according to an android Activity lifecycle.

This class allows the application to retrieve a GroundSdk session whose lifecycle is is automatically managed in correlation with a given Activity's own lifecycle.This is the recommended way to use GroundSdk API in an android Activity.

The application should obtain such a session in the onCreate method. None of the session's lifecycle management methods, as described in GroundSdk documentation, need to be called.

  • The session is automatically retained and restored upon configuration changes.
  • The session is resumed when the activity calls through super.onStart() method (by default, but the application may chose to have it resumed in when the activity calls through super.onResume() method instead).
  • The session is suspended when the activity calls through super.onStop() method (by default, but the application may chose to have it suspended in when the activity calls through super.onPause() method instead).
  • The session is automatically closed when the activity calls through onDestroy. The application MUST NOT use the session past this point.

For example:

 public class MyManagedGroundSdkActivity extends Activity {
     private ManagedGroundSdk mGroundSdk;

    @Override
     public void onCreate(@Nullable Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         mGroundSdk = ManagedGroundSdk.obtainSession(this);
     }

    @Override
     public void onDestroy() {
         super.onDestroy();
         // mGroundSdk MUST NOT be used anymore past this point
     }
 }

Types

Link copied to clipboard
Allows to specify when a managed GroundSdk session will resume/suspend its registered observers.

Functions

Link copied to clipboard
open fun close()
Closes this session.
Link copied to clipboard
Collects application &remote device debug logs.
Link copied to clipboard
Connects a drone identified by its uid.
Connects a drone identified by its uid using a specific connector.
fun connectDrone(@NonNull uid: String, @NonNull connector: DeviceConnector, @NonNull password: String): Boolean
Connects a secured drone identified by its uid.
Link copied to clipboard
Connects a remote control identified by its uid.
Connects a remote control identified by its uid using a specific connector.
Link copied to clipboard
Disconnects a drone identified by its uid.
Link copied to clipboard
Disconnects a remote control identified by its uid.
Link copied to clipboard
Forgets a drone identified by its uid.
Link copied to clipboard
Forgets a remote control identified by its uid.
Link copied to clipboard
Retrieves currently discovered services.
Link copied to clipboard
Link copied to clipboard
Gets a list of known drones and registers an observer notified each time this list changes.
Link copied to clipboard
fun <F : Facility?> getFacility(@NonNull facilityClass: Class<F>): F
Retrieves a facility.
fun <F : Facility?> getFacility(@NonNull facilityClass: Class<F>, @NonNull observer: Ref.Observer<F>): Ref<F>
Retrieves a facility and registers an observer notified each time it changes.
Link copied to clipboard
Link copied to clipboard
Gets a list of known remote controls and registers an observer notified each time this list changes.
Link copied to clipboard
open fun manageRcAccessory(@NonNull context: Context, @NonNull rcAccessory: UsbAccessory)
Commands GroundSDK to manage the given remote controller USB accessory.
Link copied to clipboard
open fun newSession(@NonNull context: Context, @Nullable savedInstanceState: Bundle): GroundSdk
Obtains a new GroundSdk session instance.
Link copied to clipboard
Obtains a GroundSdk session automatically managed according to the provided activity's lifecycle.
Link copied to clipboard
Creates a new replay stream for some local media file.
Link copied to clipboard
open fun resume()
Resumes this session.
Link copied to clipboard
open fun retain(@NonNull outState: Bundle)
Retains this session.
Link copied to clipboard
open fun suspend()
Suspends this session.